.class final Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView$onStatusChanged$1;
.super Ljava/lang/Object;
.source "GPSStatusView.kt"

# interfaces
.implements Ljava/lang/Runnable;


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;->onStatusChanged(Llt/farmis/libraries/externalgps/providers/Status;)V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x18
    name = null
.end annotation


# instance fields
.field final synthetic $state:Llt/farmis/libraries/externalgps/providers/Status;

.field final synthetic this$0:Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;


# direct methods
.method constructor <init>(Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;Llt/farmis/libraries/externalgps/providers/Status;)V
    .locals 0

    iput-object p1, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView$onStatusChanged$1;->this$0:Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;

    iput-object p2, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView$onStatusChanged$1;->$state:Llt/farmis/libraries/externalgps/providers/Status;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


# virtual methods
.method public final run()V
    .locals 6

    .line 233
    :try_start_0
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView$onStatusChanged$1;->$state:Llt/farmis/libraries/externalgps/providers/Status;

    sget-object v1, Llt/farmis/libraries/externalgps/providers/Status;->CONNECTED:Llt/farmis/libraries/externalgps/providers/Status;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    const-string v2, "-/-"

    const/4 v3, 0x0

    const-string v4, "-"

    if-ne v0, v1, :cond_9

    .line 235
    :try_start_1
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView$onStatusChanged$1;->this$0:Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;

    invoke-static {v0}, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;->access$getHdop$p(Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;)Landroid/widget/TextView;

    move-result-object v0

    if-eqz v0, :cond_0

    invoke-virtual {v0, v4}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 236
    :cond_0
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView$onStatusChanged$1;->this$0:Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;

    invoke-static {v0}, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;->access$getLatlon$p(Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;)Landroid/widget/TextView;

    move-result-object v0

    if-eqz v0, :cond_1

    invoke-virtual {v0, v2}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 237
    :cond_1
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView$onStatusChanged$1;->this$0:Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;

    invoke-static {v0}, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;->access$getSpeed$p(Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;)Landroid/widget/TextView;

    move-result-object v0

    if-eqz v0, :cond_2

    invoke-virtual {v0, v4}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 238
    :cond_2
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView$onStatusChanged$1;->this$0:Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;

    invoke-static {v0}, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;->access$getSatellites$p(Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;)Landroid/widget/TextView;

    move-result-object v0

    if-eqz v0, :cond_3

    invoke-virtual {v0, v4}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 239
    :cond_3
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView$onStatusChanged$1;->this$0:Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;

    invoke-static {v0}, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;->access$getLast_connected$p(Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;)Landroid/widget/TextView;

    move-result-object v0

    if-eqz v0, :cond_4

    invoke-virtual {v0, v4}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 240
    :cond_4
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView$onStatusChanged$1;->this$0:Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;

    invoke-static {v0}, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;->access$getLastFix$p(Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;)Landroid/widget/TextView;

    move-result-object v0

    if-eqz v0, :cond_5

    invoke-virtual {v0, v4}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 241
    :cond_5
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView$onStatusChanged$1;->this$0:Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;

    invoke-virtual {v0, v3}, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;->onQualityChanged(Ljava/lang/Integer;)V

    .line 244
    sget-object v0, Llt/farmis/libraries/externalgps/ExternalGPS;->Companion:Llt/farmis/libraries/externalgps/ExternalGPS$Companion;

    invoke-virtual {v0}, Llt/farmis/libraries/externalgps/ExternalGPS$Companion;->getInstance()Llt/farmis/libraries/externalgps/ExternalGPS;

    move-result-object v0

    invoke-virtual {v0}, Llt/farmis/libraries/externalgps/ExternalGPS;->getGpsThread()Llt/farmis/libraries/externalgps/ExternalGPSThread;

    move-result-object v0

    if-eqz v0, :cond_7

    .line 243
    sget-object v0, Llt/farmis/libraries/externalgps/ExternalGPS;->Companion:Llt/farmis/libraries/externalgps/ExternalGPS$Companion;

    invoke-virtual {v0}, Llt/farmis/libraries/externalgps/ExternalGPS$Companion;->getInstance()Llt/farmis/libraries/externalgps/ExternalGPS;

    move-result-object v0

    invoke-virtual {v0}, Llt/farmis/libraries/externalgps/ExternalGPS;->getGpsThread()Llt/farmis/libraries/externalgps/ExternalGPSThread;

    move-result-object v0

    if-eqz v0, :cond_6

    invoke-virtual {v0}, Llt/farmis/libraries/externalgps/ExternalGPSThread;->getMDeviceProvider()Llt/farmis/libraries/externalgps/providers/NMEADeviceManager;

    move-result-object v0

    instance-of v0, v0, Llt/farmis/libraries/externalgps/providers/usb/NmeaUSBDevice;

    if-eqz v0, :cond_7

    .line 245
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView$onStatusChanged$1;->this$0:Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;

    invoke-static {v0}, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;->access$getLast_connected$p(Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;)Landroid/widget/TextView;

    move-result-object v0

    if-eqz v0, :cond_7

    const-string v1, "USB"

    invoke-virtual {v0, v1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    goto :goto_0

    .line 243
    :cond_6
    invoke-static {}, Lkotlin/jvm/internal/Intrinsics;->throwNpe()V
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0

    throw v3

    .line 248
    :cond_7
    :goto_0
    :try_start_2
    sget-object v0, Llt/farmis/libraries/externalgps/ExternalGPS;->Companion:Llt/farmis/libraries/externalgps/ExternalGPS$Companion;

    invoke-virtual {v0}, Llt/farmis/libraries/externalgps/ExternalGPS$Companion;->getInstance()Llt/farmis/libraries/externalgps/ExternalGPS;

    move-result-object v0

    invoke-virtual {v0}, Llt/farmis/libraries/externalgps/ExternalGPS;->getGpsThread()Llt/farmis/libraries/externalgps/ExternalGPSThread;

    move-result-object v0

    if-eqz v0, :cond_9

    .line 249
    invoke-virtual {v0}, Llt/farmis/libraries/externalgps/ExternalGPSThread;->getMDeviceProvider()Llt/farmis/libraries/externalgps/providers/NMEADeviceManager;

    move-result-object v1

    instance-of v1, v1, Llt/farmis/libraries/externalgps/providers/bluetooth/NmeaBluetoothDevice;

    if-eqz v1, :cond_9

    .line 250
    invoke-virtual {v0}, Llt/farmis/libraries/externalgps/ExternalGPSThread;->getMDeviceProvider()Llt/farmis/libraries/externalgps/providers/NMEADeviceManager;

    move-result-object v0

    if-eqz v0, :cond_8

    check-cast v0, Llt/farmis/libraries/externalgps/providers/bluetooth/NmeaBluetoothDevice;

    invoke-virtual {v0}, Llt/farmis/libraries/externalgps/providers/bluetooth/NmeaBluetoothDevice;->getConnectedDevice()Landroid/bluetooth/BluetoothDevice;

    move-result-object v0

    invoke-virtual {v0}, Landroid/bluetooth/BluetoothDevice;->getName()Ljava/lang/String;

    move-result-object v0

    const-string v1, "(thread.mDeviceProvider \u2026getConnectedDevice().name"

    invoke-static {v0, v1}, Lkotlin/jvm/internal/Intrinsics;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    .line 251
    iget-object v1, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView$onStatusChanged$1;->this$0:Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;

    invoke-static {v1}, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;->access$getLast_connected$p(Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;)Landroid/widget/TextView;

    move-result-object v1

    if-eqz v1, :cond_9

    invoke-virtual {v1, v0}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    goto :goto_1

    .line 250
    :cond_8
    new-instance v0, Lkotlin/TypeCastException;

    const-string v1, "null cannot be cast to non-null type lt.farmis.libraries.externalgps.providers.bluetooth.NmeaBluetoothDevice"

    invoke-direct {v0, v1}, Lkotlin/TypeCastException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 255
    :cond_9
    :goto_1
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView$onStatusChanged$1;->this$0:Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;

    invoke-static {v0}, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;->access$getStatus$p(Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;)Landroid/widget/TextView;

    move-result-object v0

    if-eqz v0, :cond_a

    iget-object v1, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView$onStatusChanged$1;->$state:Llt/farmis/libraries/externalgps/providers/Status;

    iget-object v5, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView$onStatusChanged$1;->this$0:Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;

    invoke-virtual {v5}, Landroid/widget/FrameLayout;->getContext()Landroid/content/Context;

    move-result-object v5

    invoke-static {v1, v5}, Llt/noframe/gpsfarmguide/gps/NmeaLocationListener;->getMessageFromStatus(Llt/farmis/libraries/externalgps/providers/Status;Landroid/content/Context;)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 257
    :cond_a
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView$onStatusChanged$1;->$state:Llt/farmis/libraries/externalgps/providers/Status;

    sget-object v1, Llt/farmis/libraries/externalgps/providers/Status;->CONNECTING_FAILED:Llt/farmis/libraries/externalgps/providers/Status;

    if-eq v0, v1, :cond_b

    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView$onStatusChanged$1;->$state:Llt/farmis/libraries/externalgps/providers/Status;

    sget-object v1, Llt/farmis/libraries/externalgps/providers/Status;->DISCONNECTED:Llt/farmis/libraries/externalgps/providers/Status;

    if-ne v0, v1, :cond_12

    .line 258
    :cond_b
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView$onStatusChanged$1;->this$0:Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;

    invoke-static {v0}, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;->access$getHdop$p(Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;)Landroid/widget/TextView;

    move-result-object v0

    if-eqz v0, :cond_c

    invoke-virtual {v0, v4}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 259
    :cond_c
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView$onStatusChanged$1;->this$0:Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;

    invoke-static {v0}, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;->access$getLatlon$p(Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;)Landroid/widget/TextView;

    move-result-object v0

    if-eqz v0, :cond_d

    invoke-virtual {v0, v2}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 260
    :cond_d
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView$onStatusChanged$1;->this$0:Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;

    invoke-static {v0}, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;->access$getSpeed$p(Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;)Landroid/widget/TextView;

    move-result-object v0

    if-eqz v0, :cond_e

    invoke-virtual {v0, v4}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 261
    :cond_e
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView$onStatusChanged$1;->this$0:Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;

    invoke-static {v0}, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;->access$getSatellites$p(Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;)Landroid/widget/TextView;

    move-result-object v0

    if-eqz v0, :cond_f

    invoke-virtual {v0, v4}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 262
    :cond_f
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView$onStatusChanged$1;->this$0:Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;

    invoke-static {v0}, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;->access$getLast_connected$p(Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;)Landroid/widget/TextView;

    move-result-object v0

    if-eqz v0, :cond_10

    invoke-virtual {v0, v4}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 263
    :cond_10
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView$onStatusChanged$1;->this$0:Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;

    invoke-static {v0}, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;->access$getLastFix$p(Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;)Landroid/widget/TextView;

    move-result-object v0

    if-eqz v0, :cond_11

    invoke-virtual {v0, v4}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 264
    :cond_11
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView$onStatusChanged$1;->this$0:Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;

    invoke-virtual {v0, v3}, Llt/noframe/gpsfarmguide/widgets/gps/GPSStatusView;->onQualityChanged(Ljava/lang/Integer;)V
    :try_end_2
    .catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_0

    goto :goto_2

    :catch_0
    move-exception v0

    .line 267
    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    :cond_12
    :goto_2
    return-void
.end method
